import 'package:flutter/cupertino.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';

class InitPlugin {
  static const String _CHANNEL_GCYW_INIT = "gcyw/init";
  static const MethodChannel _initChannel = const MethodChannel(_CHANNEL_GCYW_INIT);

  factory InitPlugin() => _getInstance();
  static InitPlugin _instance;
  InitPlugin._internal();

  static InitPlugin _getInstance() {
    if (_instance == null) {
      _instance = InitPlugin._internal();
    }
    return _instance;
  }

  Future<bool> initApp() async {
    try {
      return _initChannel.invokeMethod("initApp");
    } on PlatformException {
      return false;
    }
  }

  ///打开开屏广告
  Future<bool> showSplashAd() async {
    try {
      return _initChannel.invokeMethod("showSplashAd");
    } on PlatformException {
      return false;
    }
  }


  Future<bool> showSplashLyAd() async {
    try {
      return _initChannel.invokeMethod("showSplashLyAd");
    } on PlatformException {
      return false;
    }
  }
}
